package edu.hunau.cxb19.oop.class32.udp.v1;

import java.net.DatagramPacket;
import java.net.DatagramSocket;

/**
 *
 * @author hb
 *
 *         2020-04-23 16:02:30
 */
public class UDPClient {
	public static void main(String[] args) throws Exception {
		byte[] buff = new byte[1024];
		DatagramPacket dp = new DatagramPacket(buff, buff.length);
		DatagramSocket client = new DatagramSocket(6000);// 客户端在端口6000进行等待
		client.receive(dp);
		System.out.println(new String(dp.getData(), 0, dp.getLength()));
		client.close();
	}
}
